package com.gmrz.webauthn.protocol.v1.schema;

import com.google.gson.annotations.SerializedName;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


public enum AuthenticatorAttachment {
    @SerializedName("platform")
    PLATFORM("platform"),

    @SerializedName("cross-platform")
    CROSS_PLATFORM("cross-platform");


    private String mValue;

    private static final Logger LOG = LogManager.getLogger(AuthenticatorAttachment.class);

    AuthenticatorAttachment(String value) {
        this.mValue = value;
    }

    public String toString() {
        return this.mValue;
    }

    public static AuthenticatorAttachment forName(String strValue) {
        for (AuthenticatorAttachment value : values()) {
            if (value.mValue.equals(strValue)) {
                return value;
            }
        }

        String errorMsg = " AuthenticatorAttachment has invalid value : " + (strValue.trim().equals("") ? "EMPTY" : strValue);
        LOG.error(errorMsg);
        throw new IllegalArgumentException(errorMsg);
    }
}
